﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using QiAdmin.Core;
using QiAdmin.Core.Attributes;
using QiAdmin.Core.Models;
using QiAdmin.Core.Services.Cache;
using QiAdmin.Core.Utils;
using QiAdmin.Model.Dtos.Input;
using QiAdmin.Model.System.Models;
using QiAdmin.Service.IService;
using QiAdmin.Service.Service;

namespace QiAdmin.WebApi.Controllers.System
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SysNoticeController : ControllerBase
    {
        readonly ITSysNoticeService _sysNoticeService;
        public SysNoticeController(ITSysNoticeService sysNoticeService)
        {
            _sysNoticeService = sysNoticeService;
        }

        [Permission(PermissionType.Query)]
        [HttpPost]
        public ApiJsonResult GetPageList(TSysNotice_IN input)
        {
            var res = _sysNoticeService.GetPageList(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Add)]
        [HttpPost]
        public ApiJsonResult Add(TSysNotice_IN input)
        {
            var res = _sysNoticeService.Add(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Edit)]
        [HttpPost]
        public ApiJsonResult Edit(TSysNotice_IN input)
        {
            var res = _sysNoticeService.Edit(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Query)]
        [HttpPost]
        public ApiJsonResult Get(TSysNotice_IN input)
        {
            var res = _sysNoticeService.Get(input);
            return ApiJsonResult.Convert(res);
        }

        [Permission(PermissionType.Delete)]
        [HttpPost]
        public ApiJsonResult RemoveRange(List<TSysNotice_IN> input)
        {
            var res = _sysNoticeService.RemoveRange(input);
            return ApiJsonResult.Convert(res);
        }
    }
}
